//
//  CDraft.h
//  HotDisPlus
//
//  Created by yilong zhang on 12-6-27.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "CDBManager.h"
#import "CDownLoadManager.h"

#define Draft_properties_Num    15

@protocol DraftDelegate <NSObject>

@optional

@end

@interface CDraft : NSObject <OperationDelegate>

@property (nonatomic, retain) NSNumber  *m_lnID;
@property (nonatomic, retain) NSNumber  *m_lnTID;
@property (nonatomic, retain) NSNumber  *m_nSate;               //0-native,1-network;
@property (nonatomic, retain) NSString  *m_strName;
@property (nonatomic, retain) NSString  *m_strResName;
@property (nonatomic, retain) NSString  *m_strAddr;
@property (nonatomic, retain) NSString  *m_strSum;
@property (nonatomic, retain) NSString  *m_strCity;
@property (nonatomic, retain) NSString  *m_strProvince;
@property (nonatomic, retain) NSString  *m_strCountry;
@property (nonatomic, retain) NSNumber  *m_nX;
@property (nonatomic, retain) NSNumber  *m_nY;
@property (nonatomic, retain) NSString  *m_strMainImgUrl;       //mainimage
@property (nonatomic, retain) NSString  *m_strMainImgPath;      //mianimagepath
@property (nonatomic, retain) NSString  *m_strPath;
@property (nonatomic, assign) int       m_nCoverIndex;

@property (nonatomic, assign) BOOL          m_bIsLoad;
@property (nonatomic, assign) UIImageView   *m_Image;
@property (nonatomic, retain) CTask         *m_Task;

+(int)CreateDraftTable:(NSString*)tablename;
+(int)GetDraftTotal:(NSString*)tablename Where:(NSString*)where;
+(NSArray*)GetLimitDraft:(NSString*)tablename Where:(NSString*)where Offset:(int)offset Limit:(int)limit;
+(int)UpdateDraftInfo:(NSString*)tablename Where:(NSString*)where Keys:(NSArray*)keys;
+(int)RemoveDraft:(NSString*)tablename Where:(NSString*)where;

-(void)CrreatePath;
-(void)SetDraftWithArr:(NSArray*)arr;
-(void)SetDraftWithDic:(NSDictionary*)dic;
-(int)SaveDraft:(NSString*)tablename;

-(void)SaveMainImage:(NSString*)path Data:(NSData*)data;
-(NSData*)GetMainImage;
-(void)DownLoadMainImage;
-(void)CancelDownLoadImage;

@end
